package com.seednia.module.core.tagging.dto;

import java.util.Collection;

import com.seednia.module.core.user.dto.UserDto;


/**
 * Interface for records that can be tagged.
 * 
 * @author Young Suk Ahn
 *
 */
public interface ITaggable {
	
	/**
	 * Name of the taggable, E.g. "Post";
	 * @return
	 */
	Collection<String> getTagTypes();

	/**
	 * Returns the specific tagging dto class
	 * Useful for instanting object using reflection
	 * @return
	 */
	Class<?> getTaggingDtoClass(String type);
	

	/**
	 * The sid of the target record to which the tags are associated with;
	 * This is already implemented by the AbstractRecord
	 * @return
	 */
	Long getSid();
	
	int size();

	/**
	 * 
	 * @param creatorDto
	 * @param tagDto
	 */
	TaggingDto createTaggingDto(String type, ITaggable taggable, UserDto creatorDto, TagDto tagDto);

	/**
	 * Checks wether the taggable already has tag
	 * @return
	 */
	boolean containsTag(String type, String tagName);
	
	/**
	 * Returns an array or tag names
	 * @return
	 */
	String[] getTagNames(String type);

	/**
	 * Sets the tag names provided as array
	 * @param tagNames
	 */
	void setTagNames(String type, String[] tagNames);

	/**
	 * Returns a string with the list of target names separated by comma
	 * @return
	 */
	String getTagNamesCsv(String type);

	/**
	 * Sets the tags by passing a string with tag names separated by comma
	 * @param tagNamesCsv
	 */
	void setTagNamesCsv(String type, String tagNamesCsv);

	/**
	 * Returns the Tag Dto that matches the tagName
	 * @return
	 */
	//TagDto getTagDto(String type, String tagName);

	/**
	 * Returns a list of Tag DTOs
	 * @return
	 */
	//Collection<TagDto> getTagDtos(String type);
	
	/**
	 * Returns the Tag Dto that matches the tagName
	 * @return
	 */
	TaggingDto getTaggingDto(String type, String tagName);
	
	/**
	 * Returns a list of Tagging DTOs (assocation of object and the tag)
	 * @return
	 */
	Collection<TaggingDto> getTaggingDtos(String type);
	
	/**
	 * 
	 * @param tagDtos
	 */
	void setTaggingDtos(String type, Collection<TaggingDto> taggingDtos);
	
	/**
	 * Add a new tagging
	 * @param taggingDto
	 */
	void addTaggingDto(String type, TaggingDto taggingDto);
	
	/**
	 * Remove
	 * @param taggingDto
	 */
	void removeTaggingDto(String type, TaggingDto taggingDto);
}
